﻿using SameGame.Presentation;
using SameGame.Statistic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SameGame
{
	/// <summary>
	/// Interaction logic for BallsStatisticUserControl.xaml
	/// </summary>
	public partial class BallsStatisticUserControl : UserControl, IBoardBallsStatisticView
	{
		private IBoardBallsStatisticPresenter _presenter;

		public BallsStatisticUserControl(IBoardBallsStatisticPresenter presenter)
		{
			InitializeComponent();
			_presenter = presenter;
			_presenter.View = this;
		}

		public void SetColorStatistic(SortedDictionary<int, int> colors)
		{
			stackPanel.Children.Clear();

			foreach (KeyValuePair<int, int> pair in colors)
			{
				BallCountUserControl ballCount = new BallCountUserControl();
				ballCount.BallType = pair.Key;
				ballCount.Count = pair.Value;
				stackPanel.Children.Add(ballCount);
			}
		}
	}
}
